unit pref;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, ComCtrls, ExtDlgs, jpeg, ColorGrd, desktop;

type
  Tprefwindow = class(TForm)
    tabcontroller: TPageControl;
    tab_bg: TTabSheet;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Image1: TImage;
    Bevel1: TBevel;
    ListBox1: TListBox;
    Button4: TButton;
    Button6: TButton;
    openbg: TOpenPictureDialog;
    Panel1: TPanel;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    bgcol: TPanel;
    bg_color_pr: TPanel;
    Panel2: TPanel;
    imagemode: TComboBox;
    Button5: TButton;
    Button8: TButton;
    Label4: TLabel;
    Label5: TLabel;
    Panel3: TPanel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    tbar_cl_b: TTrackBar;
    tbar_cl_r: TTrackBar;
    tbar_cl_g: TTrackBar;
    tbar_cl_pr: TPanel;
    tb_col: TShape;
    colorr: TTrackBar;
    colorg: TTrackBar;
    colorb: TTrackBar;
    Button7: TButton;
    tab_cust: TTabSheet;
    procedure Button2Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button8Click(Sender: TObject);
    procedure tbar_cl_rChange(Sender: TObject);
    procedure tbar_cl_gChange(Sender: TObject);
    procedure tbar_cl_bChange(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure colorrChange(Sender: TObject);
    procedure colorgChange(Sender: TObject);
    procedure colorbChange(Sender: TObject);
    procedure Button7Click(Sender: TObject);
  private
    { Private declarations }

  public
    { Public declarations }
  end;

var
  prefwindow: Tprefwindow;

implementation

uses startmenu;

{$R *.dfm}

procedure Tprefwindow.Button2Click(Sender: TObject);
begin
  prefwindow.Close;
end;

procedure Tprefwindow.Button5Click(Sender: TObject);
begin
  openbg.Execute;
  image1.Picture.LoadFromFile(openbg.FileName);
  image1.Stretch := true;
  end;

procedure Tprefwindow.Button8Click(Sender: TObject);
begin
bgcol.Color := RGB(colorr.Position,colorg.Position,colorb.position);
end;

procedure Tprefwindow.tbar_cl_rChange(Sender: TObject);
begin
  tbar_cl_pr.Color := RGB(tbar_cl_r.Position,tbar_cl_g.Position,tbar_cl_b.Position);
end;

procedure Tprefwindow.tbar_cl_gChange(Sender: TObject);
begin
  tbar_cl_pr.Color := RGB(tbar_cl_r.Position,tbar_cl_g.Position,tbar_cl_b.Position);
end;

procedure Tprefwindow.tbar_cl_bChange(Sender: TObject);
begin
  tbar_cl_pr.Color := RGB(tbar_cl_r.Position,tbar_cl_g.Position,tbar_cl_b.Position);
end;

procedure Tprefwindow.Button3Click(Sender: TObject);
begin
startpanel.Color := tb_col.Brush.Color;
begin
try
dgs.background.Picture.LoadFromFile(openbg.FileName);
except end;
dgs.Color := prefwindow.bgcol.color;

if imagemode.ItemIndex = 0 then dgs.background.Center := true
else dgs.background.Center := false;
end;
end;

procedure Tprefwindow.colorrChange(Sender: TObject);
begin
  bg_color_pr.Color := RGB(colorr.Position,colorg.Position,colorb.position);
end;

procedure Tprefwindow.colorgChange(Sender: TObject);
begin
  bg_color_pr.Color := RGB(colorr.Position,colorg.Position,colorb.position);
end;

procedure Tprefwindow.colorbChange(Sender: TObject);
begin
  bg_color_pr.Color := RGB(colorr.Position,colorg.Position,colorb.position);

end;

procedure Tprefwindow.Button7Click(Sender: TObject);
begin

  tb_col.Brush.Color := RGB(tbar_cl_r.Position,tbar_cl_g.Position,tbar_cl_b.Position);
end;

end.
